<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>添加部门</title>
		<link rel="stylesheet" type="text/css" href="${ctx }/css/caas_style.css" />
		<script type="text/javascript" src="${ctx }/js/jquery/jquery-1.3.min.js"></script>
		<script type="text/javascript" src="${ctx}js/jquery/lhgdialog/lhgcore.min.js"></script>
		<script type="text/javascript" src="${ctx}js/jquery/lhgdialog/lhgdialog.min.js"></script>
		<SCRIPT language=JavaScript>  
			jQuery(document).ready(function(){			
			    var dg = frameElement.lhgDG; 			   
			   			   
			    var param = dg.getArgs();
			   
			    dg.addBtn("btn_confirm","确定",confirmClick,"left");
			   
			    //确定按钮单击事件
				function confirmClick(){				
					var url = "${base}/user/resetPwd";
					param.pwd = jQuery("#pwd").val();	
					param.pwd1 = jQuery("#pwd1").val();			
					
					var flag = validate(param);
					if(!flag){
						return;
					}
					jQuery.post(url,param,function(data,textStatus,jqXHR){
						if(data.success){
							alert("修改成功!");
						}else{
							alert("修改失败!");
						}						
						dg.cancel();
					},'json');
											
				}
				//end 确定按钮单击事件
				
						
				
				//检查页面元素输入的值是否合法
				function validate(param){					
					if(param.pwd == null || param.pwd  == ''){
						alert("密码不能为空!");
						jQuery("#pwd").focus();
						return false;
					}else if(param.pwd.length  > 10){
						alert("密码不能超过10-个字符!");
						jQuery("#pwd").focus();
						return false;
					}else if(!checkPwd(param.pwd)){
						alert("密码只能由字母和数据组成!");
						jQuery("#pwd").focus();
						return false;
					}
					if(param.pwd1  == null || param.pwd1  == ''){
						alert("确认密码不能为空!");
						jQuery("#pwd1").focus();
						return false;
					}
					if(param.pwd1  != param.pwd){
						alert("你输入的密码不一致!");
						jQuery("#pwd1").focus();
						return false;
					}
					
					return true;
				}
				//end 检查页面元素输入的值是否合法
			});
			
			function checkPwd(val){
				var regNum =/^[A-Za-z0-9]+$/;
				return regNum.test(val)
			}
		</SCRIPT>
	</head>

	<body>
		<table width="99%" border="0" cellspacing="0" cellpadding="0"
			align="center">
			<tr>
				<td>
					<div class="biaoge">
						<form action="${ctx}/org/resetPwd" method="post" name="mainform" id="mainform">
							<table width="100%" border="0" cellspacing="1" cellpadding="0">
								<tr>
									<td align="left" class="biaoge_bg01" colspan="4">
										密码信息
									</td>
								</tr>
								
								<tr>
									<td width="30%" align="right" class="bg04" maxlength="10">
										密码:
									</td>
									<td width="70%" class="biaoge_bg5">
										<label>
											<input type="password" name="pwd" id="pwd" size="30"  maxlength="10"/><font color="red" size="4">*</font>
										</label>
									</td>
									
								</tr>
								<tr>
									<td width="30%" align="right" class="bg04">
										确认密码：
									</td>
									<td width="70%" class="biaoge_bg5">
										<label>
											<input type="password" name="pwd1" id="pwd1"  size="30" maxlength="10"/><font color="red" size="4">*</font>
										</label>
									</td>
								</tr>
							</table>
						</form>
					</div>
				</td>
			</tr>
		</table>
</html>